import { FighterModel } from "./fighterModel"
import { ItemModel } from "./itemModel"
import { SkillDataModel } from "./skillDataModel"

export class TeamListModel {
    list: PartnerModel[]
    camp: PartnerModel[]
    constructor(opts: any = {}) {
        this.list = opts.list || new Array(10).fill(null)
        this.camp = opts.camp || new Array(50).fill(null)
    }
}

export class TalentModel {
    lvl: number
    points: number
    activeNodes: any
    constructor(opts: any) {
        this.lvl = opts.lvl || 0
        this.points = opts.points || 0
        this.activeNodes = opts.activeNodes || {}
    }
}

export class EquipmentsModel {
    hand: ItemModel
    head: ItemModel
    body: ItemModel
    foot: ItemModel
    neck: ItemModel
    wrist: ItemModel
    finger: ItemModel
    cloak: ItemModel
    waist: ItemModel
    palm: ItemModel
    subHand: ItemModel
    constructor(opts: any = {}) {
        this.hand = opts.hand || null
        this.head = opts.head || null
        this.body = opts.body || null
        this.foot = opts.foot || null
        this.neck = opts.neck || null
        this.wrist = opts.wrist || null
        this.finger = opts.finger || null
        this.cloak = opts.cloak || null
        this.waist = opts.waist || null
        this.palm = opts.palm || null
        this.subHand = opts.subHand || null
    }
}

export class TreasureModel {
    items: any
    posLvls: any
    constructor(opts: any) {
        this.items = opts.items || {}
        this.posLvls = opts.posLvls || {}
    }
}



export class PartnerModel {
    tID: number
    name: string//角色名
    autoGetTimer: number
    //tresasureLvls: number[]
    lvl: number
    exp: number
    equipmentActive: number //使用中的装备方案
    equipments: EquipmentsModel[] //穿着的装备  多个方案
    petOn: ItemModel
    skillData: SkillDataModel
    fighter: FighterModel
    partStr: any
    attriStrLvls: any
    tianFu: number//自由天赋点数
    skillLvls: any
    treasure: TreasureModel
    talent: TalentModel
    quality: number
    index: string
    formationPos: number
    star: number
    customFeature: any
    busy: boolean
    constructor(opts: any = {}) {
        this.tID = opts.tID || 110001
        this.name = opts.name || ''
        this.autoGetTimer = opts.autoGetTimer || -1
        //this.tresasureLvls = opts.tresasureLvls || [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]//每个门派的宝物等级
        this.lvl = opts.lvl || 1
        this.exp = opts.exp || 0
        this.fighter = opts.fighter || null
        this.skillData = new SkillDataModel(opts.skillData)
        this.equipmentActive = opts.equipmentActive || 0
        this.equipments = opts.equipments || []
        this.petOn = opts.petOn || null
        this.partStr = opts.partStr || {}
        this.attriStrLvls = opts.attriStrLvls || {}
        this.tianFu = opts.tianFu || 0
        this.skillLvls = opts.skillLvls || {}
        for (let i = 0; i < 3; i++) {
            let item = this.equipments[i]
            this.equipments[i] = new EquipmentsModel(item)
        }
        this.treasure = opts.treasure || new TreasureModel({})
        this.talent = opts.talent || new TalentModel({})
        this.quality = opts.quality || 0
        this.index = opts.index || null
        this.formationPos = opts.formationPos || null
        this.star = opts.star || 0
        this.customFeature = opts.customFeature || null
    }
}